
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>爱国情感分析系统 - 访问测试</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 40px; background-color: #f5f5f5; }
        .container { max-width: 800px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
        .header { text-align: center; color: #333; margin-bottom: 30px; }
        .test-item { margin: 15px 0; padding: 15px; border: 1px solid #ddd; border-radius: 5px; background: #f9f9f9; }
        .success { background-color: #d4edda; border-color: #c3e6cb; }
        .warning { background-color: #fff3cd; border-color: #ffeaa7; }
        .error { background-color: #f8d7da; border-color: #f5c6cb; }
        .btn { display: inline-block; padding: 10px 20px; margin: 10px 5px; text-decoration: none; border-radius: 5px; font-weight: bold; }
        .btn-primary { background-color: #007bff; color: white; }
        .btn-success { background-color: #28a745; color: white; }
        .btn-warning { background-color: #ffc107; color: black; }
    </style>
    <script>
        function testAccess(url, name) {
            fetch(url)
                .then(response => {
                    if (response.ok) {
                        document.getElementById('result-' + name).innerHTML = 
                            '<span style="color: green;">✅ 访问成功 (状态码: ' + response.status + ')</span>';
                    } else {
                        document.getElementById('result-' + name).innerHTML = 
                            '<span style="color: red;">❌ 访问失败 (状态码: ' + response.status + ')</span>';
                    }
                })
                .catch(error => {
                    document.getElementById('result-' + name).innerHTML = 
                        '<span style="color: red;">❌ 访问失败: ' + error.message + '</span>';
                });
        }
        
        function testAllPages() {
            const pages = [
                {url: '/', name: 'home'},
                {url: '/patriotic_prompt/', name: 'main'},
                {url: '/patriotic_prompt/batch_analyze', name: 'batch'},
                {url: '/patriotic_prompt/standalone', name: 'standalone'}
            ];
            
            pages.forEach(page => {
                testAccess(page.url, page.name);
            });
        }
    </script>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🎯 爱国情感分析系统访问测试</h1>
            <p>测试各个页面的访问状态</p>
        </div>
        
        <div class="test-item warning">
            <h3>⚠️ 注意事项</h3>
            <p>确保Flask应用正在运行：<code>python app.py</code></p>
            <p>默认访问地址：<a href="http://localhost:5000">http://localhost:5000</a></p>
        </div>
        
        <div class="test-item">
            <h3>🔍 页面访问测试</h3>
            <button class="btn btn-primary" onclick="testAllPages()">开始测试所有页面</button>
            <div style="margin-top: 20px;">
                <p><strong>系统主页：</strong> <span id="result-home">等待测试...</span></p>
                <p><strong>爱国情感分析主页：</strong> <span id="result-main">等待测试...</span></p>
                <p><strong>批量分析页面：</strong> <span id="result-batch">等待测试...</span></p>
                <p><strong>独立版本主页：</strong> <span id="result-standalone">等待测试...</span></p>
            </div>
        </div>
        
        <div class="test-item">
            <h3>🔗 直接访问链接</h3>
            <a href="/" class="btn btn-primary">系统主页</a>
            <a href="/patriotic_prompt/" class="btn btn-success">爱国情感分析主页</a>
            <a href="/patriotic_prompt/batch_analyze" class="btn btn-warning">批量分析页面</a>
            <a href="/patriotic_prompt/standalone" class="btn btn-primary">独立版本</a>
        </div>
        
        <div class="test-item success">
            <h3>✅ 使用说明</h3>
            <ol>
                <li>确保Flask应用正在运行</li>
                <li>点击"开始测试所有页面"按钮测试访问状态</li>
                <li>或直接点击下方的链接访问各个页面</li>
                <li>如果遇到问题，请检查控制台输出的错误信息</li>
            </ol>
        </div>
        
        <div class="test-item">
            <h3>🚀 快速启动指南</h3>
            <ol>
                <li>打开终端，进入项目目录</li>
                <li>激活虚拟环境：<code>venv_new\Scripts\activate</code></li>
                <li>启动应用：<code>python app.py</code></li>
                <li>访问：<code>http://localhost:5000</code></li>
            </ol>
        </div>
    </div>
</body>
</html>
    